//
//  EditModel.m
//  EducationAdminClient
//
//  Created by kwsdzjx on 16/8/22.
//  Copyright © 2016年 周佳兴. All rights reserved.
//

#import "EditModel.h"

@implementation EditModel
+(JSONKeyMapper*)keyMapper {
    
    /* 注意JuhuiModel里面需要映射2种类型
     1. 驼峰Camel命名规范
     2. 把author.header_img和author_username要映射到JuhuiModel直接字段里面 */
    JSONKeyMapper *mapper = [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
    // 取得影射的blocks对象
    JSONModelKeyMapBlock modelBlock = mapper.modelToJSONKeyBlock;
    
    // 根据上述的重新创建映射条件
    JSONKeyMapper *newMapper = [[JSONKeyMapper alloc] initWithJSONToModelBlock:nil modelToJSONBlock:^NSString *(NSString *keyName) {
        // 告诉我们影射规律
        if ([keyName isEqualToString:@"fieldAliasName"]) {
            return @"fieldAliasName";
        } else if ([keyName isEqualToString:@"fieldCnName"]) {
            return @"fieldCnName";
        } else if ([keyName isEqualToString:@"fieldId"]) {
            return @"fieldId";
        } else if ([keyName isEqualToString:@"fieldRole"]) {
            return @"fieldRole";
        }else if ([keyName isEqualToString:@"ifMust"]) {
            
            return @"ifMust";
        }else if ([keyName isEqualToString:@"ifUpdate"]) {
            
            return @"ifUpdate";
        }else if ([keyName isEqualToString:@"montageName"]) {
            
            return @"montageName";
        }else if ([keyName isEqualToString:@"true_defaultShowValName"]) {
            
            return @"true_defaultShowValName";
        }else if ([keyName isEqualToString:@"dicChildShow"]) {
            
            return @"dicChildShow";
        }else if ([keyName isEqualToString:@"dicDefaultSelect"]) {
            
            return @"dicDefaultSelect";
        }else if ([keyName isEqualToString:@"dicList"]) {
            
            return @"dicList";
        }else if ([keyName isEqualToString:@"addStyle"]) {
            
            return @"addStyle";
        }else if ([keyName isEqualToString:@"chooseType"]) {
            
            return @"chooseType";
        }else if ([keyName isEqualToString:@"dialogField"]) {
            
            return @"dialogField";
        }else if ([keyName isEqualToString:@"needFilter"]) {
            
            return @"needFilter";
        }else if ([keyName isEqualToString:@"pageDialog"]) {
            
            return @"pageDialog";
        }else if ([keyName isEqualToString:@"relationTableId"]) {
            
            return @"relationTableId";
        }else if ([keyName isEqualToString:@"jsWhereStr"]) {
            
            return @"jsWhereStr";
        }else if ([keyName isEqualToString:@"true_defaultShowValId"]) {
            
            return @"true_defaultShowVal";// true_defaultShowValId被人更改成这个，有可能要改回来
        }else if ([keyName isEqualToString:@"showFieldArr"]) {
            
            return @"showFieldArr";
        }else if ([keyName isEqualToString:@"tableId"]) {
            
            return @"tableId";
        }else if ([keyName isEqualToString:@"dialogDataList"]) {
            
            return @"dialogDataList";
        }else if ([keyName isEqualToString:@"dialogSearchSet"]) {
            
            return @"dialogSearchSet";
        }else if ([keyName isEqualToString:@"dicOptions"]) {
            
            return @"dicOptions";
        }else if ([keyName isEqualToString:@"true_defaultShowVal"]) {
            
            return @"true_defaultShowVal";
        }else if ([keyName isEqualToString:@"dicOptions"]) {
            
            return @"dicOptions";
        }else if ([keyName isEqualToString:@"indexPath"]) {
            
            return @"indexPath";
        }else if ([keyName isEqualToString:@"indexPathRow"]) {
            
            return @"indexPathRow";
        }else if ([keyName isEqualToString:@"dateType"]) {
            
            return @"dateType";
        }else if ([keyName isEqualToString:@"tmpFieldId"]) {
            
            return @"tmpFieldId";
        }else if ([keyName isEqualToString:@"montageName1"]) {
            
            return @"montageName1";
        }else if ([keyName isEqualToString:@"ifShowDefVal"]) {
            
            return @"ifShowDefVal";
        }
        return modelBlock(keyName);
    }];
    return newMapper;
    
    
    //return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
}


+(BOOL)propertyIsOptional:(NSString*)propertyName {
    return  YES;
}

@end
